package com.example.ioc.base;

import jakarta.annotation.PostConstruct;
import jakarta.annotation.PreDestroy;
import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.InitializingBean;

public class OrderService implements InitializingBean, DisposableBean {
    @Override
    public void afterPropertiesSet() throws Exception {
        System.out.println("InitializingBean 初始化");
    }

    @PostConstruct
    public void init() throws Exception {
        System.out.println("PostConstruct 初始化");
    }


    public void init2(){
        System.out.println("initMethod 初始化");
    }

    @Override
    public void destroy() throws Exception {
        System.out.println("接口：DisposableBean 销毁");
    }

    @PreDestroy
    public void  destroy2() throws Exception{
        System.out.println("注解：PreDestroy 销毁");
    }

    public void destroyMethod(){
        System.out.println("注解：Bean 销毁");
    }


}
